﻿using Kannon.Core;
using Kannon.Middleware;

using NUnit.Framework;

namespace Kannon.Tests.Integration
{
    public class BlogApplication : KannonApplication
    {
        public BlogApplication()
        {
            Install<RequestLoggerMiddleware>();
            Install<ErrorHandlerMiddleware>();
            
            Dispatch("/about", () => "Kannon is an attempt to create a full-stack open-source lightweight web framework for .NET. Without ASP.NET.");
            Dispatch("/", Index);
        }

        private static KannonResponse Index()
        {
            return "Hello, World! You're on Kannon now.";
        }
    }

    [TestFixture]
    public class KannonApplicationIntegrationTests
    {
        [Test]
        public void Handle()
        {
            var blog = new BlogApplication();
            blog.Handle(new KannonRequest());
        }
    }
}
